#!/usr/bin/env python
from __future__ import unicode_literals
from __future__ import absolute_import
from time import mktime, strptime, localtime, strftime


def to_timestamp(standard_val):
    '''
    input timestamp output  standard(%Y%m%d%H%M)(201601012358)
    '''
    return mktime(strptime(standard_val, "%Y%m%d%H%M"))


def to_standard(time_val, fmt="%Y/%m/%d %H:%M"):
    '''
    in standard time (%Y%m%d%H%M)(201601012358)
    out timestamp
    '''
    date_obj = localtime(int(time_val))
    return strftime(fmt, date_obj)
